package testcase.doctor;


import org.json.JSONObject;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import api.doctor.PCReportQuery;
import common.Host;
import common.TestData;


/**
 * 帮忙医医生端获取获取多份报告PCReportQuery接口测试用例
 * @author lipeng
 *
 */
public class TestPCReportQuery {
	/**
	 * 帮忙医医生端获取多份报告PCReportQuery接口测试数据驱动
	 * @return
	 * @throws Exception
	 */
    @DataProvider(name="Test")
    public static String[][] testPCReportQueryDataProvider() throws Exception{
    	Host.setup("Test");
    	TestData td = new TestData("doctor/TestPCReportQuery.xml");
    	return td.getParam();
    }
    
    @Test(dataProvider="Test",groups={"Test"})
    public void testPCReportQueryTestCase(String casename,String token,String userId,String isSearch)throws Exception{
    	String result = PCReportQuery.get(token, userId, isSearch);
    	JSONObject jsonResult;
    	if(result ==null ||result.isEmpty()){
    		jsonResult = null;
    	}else {
			jsonResult = new JSONObject(result);
		}
    	
    	//设置检查点
    	switch (casename) {
		case "GetMultipleReports":
			 Assert.assertEquals(jsonResult.getJSONArray("Data").getString(0).isEmpty(), false);	
			 break;
		case "InvalidUserid":
			Assert.assertEquals(jsonResult.getString("Data"), "[]");	
			 break;
		default:
			break;
		}
    }
}
